// Decompiled by GOOSIN CO,LTD Copyright 2010 Pavel Kouznetsov.
// home page: http://www.Goosin.net
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   ValidataTag1.java

package include.query;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class ValidataTag1
{

	public String tag;
	private String dbase;
	private String className;
	private String field1;
	private String field2;
	private String fieldValue;

	public ValidataTag1()
	{
		dbase = "";
		className = "";
		field1 = "";
		field2 = "";
		fieldValue = "";
	}

	public static String Transform(String data)
	{
		String mtid[] = {
			"_a+", "_b+", "_c+", "_d+", "_e+", "_f+", "_g+", "_h+", "_i+", "_j+", 
			"_k+", "_l+", "_m+", "_n+", "_o+", "_p+", "_q+", "_r+", "_s+", "_t+", 
			"_u+", "_v+", "_w+", "_x+", "_y+", "_z+"
		};
		String replaceValue[] = {
			"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", 
			"K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", 
			"U", "V", "W", "X", "Y", "Z"
		};
		String temp = data;
		temp = Replace(temp, "_ID", "_id");
		String s = "";
		for (int i = 0; i < mtid.length; i++)
		{
			String regEx = mtid[i];
			Pattern p = Pattern.compile(regEx);
			Matcher m = p.matcher(temp);
			s = m.replaceAll(replaceValue[i]);
			temp = s;
		}

		String alpha = s.substring(0, 1);
		alpha = alpha.toUpperCase();
		s = (new StringBuilder(String.valueOf(alpha))).append(s.substring(1, s.length())).toString();
		return s;
	}

	public static String Transform1(String data)
	{
		data = data.toLowerCase();
		String mtid[] = {
			"_a+", "_b+", "_c+", "_d+", "_e+", "_f+", "_g+", "_h+", "_i+", "_j+", 
			"_k+", "_l+", "_m+", "_n+", "_o+", "_p+", "_q+", "_r+", "_s+", "_t+", 
			"_u+", "_v+", "_w+", "_x+", "_y+", "_z+"
		};
		String replaceValue[] = {
			"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", 
			"K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", 
			"U", "V", "W", "X", "Y", "Z"
		};
		String temp = data;
		temp = Replace(temp, "_ID", "_id");
		String s = "";
		for (int i = 0; i < mtid.length; i++)
		{
			String regEx = mtid[i];
			Pattern p = Pattern.compile(regEx);
			Matcher m = p.matcher(temp);
			s = m.replaceAll(replaceValue[i]);
			temp = s;
		}

		return s;
	}

	public static String Transform2(String data)
	{
		String field = (new StringBuilder("get")).append(Transform(data)).toString();
		return field;
	}

	public static String Replace(String source, String oldString, String newString)
	{
		if (source == null)
			return null;
		StringBuffer output = new StringBuffer();
		int lengOfsource = source.length();
		int lengOfold = oldString.length();
		int posStart;
		int pos;
		for (posStart = 0; (pos = source.indexOf(oldString, posStart)) >= 0; posStart = pos + lengOfold)
		{
			output.append(source.substring(posStart, pos));
			output.append(newString);
		}

		if (posStart < lengOfsource)
			output.append(source.substring(posStart));
		return output.toString();
	}
}
